layui.config({
    base: '../../../eui/plugins/layui-extend/' //这是你存放拓展模块的根目录
});

layui.use(['form'], function () {
    var form = layui.form;
    var id = getParam("id");
    dict2Select("outputType","outputType"); //数据字典赋值下拉框，具体看base.js中dict2Select方法
    form.render();
    if(!isNull(id)){
		$("#expName").attr("disabled","disabled");
    	io.get('/mm/expressions/' + id,function(res){
    		var data = res.data;
            var form = layui.form;
            //表单初始赋值
            form.val('lForm', data)
            form.render();
    	});
    }else{
		    form.val('lForm', {"outputType":"java.lang.Double","priority":10})
            form.render();
	}

    //监听提交
    form.on('submit(save)', function (form) {
        var data=form.field;
		io.post('/mm/expressions',JSON.stringify(data),function(res){
	               setTimeout(function(){return closePage();},1000);
	               window.parent.refreshTableData();
		});
		return false;
    });
});